/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.dusin.wufang.graph.shape;

import com.mxgraph.canvas.mxGraphics2DCanvas;
import com.mxgraph.shape.mxBasicShape;
import com.mxgraph.view.mxCellState;
import java.awt.Rectangle;

/**
 *
 * @author Admin
 */
public class VDaozha extends mxBasicShape {

    @Override
    public void paintShape(mxGraphics2DCanvas canvas, mxCellState state) {
        Rectangle rect = state.getRectangle();
		int x = rect.x;
		int y = rect.y;
		int w = rect.width;
		int h = rect.height;
		String isOpen = (String)state.getStyle().get("isOpen");
		System.out.println(isOpen);
		// Paints the foreground
		if (configureGraphics(canvas, state, false))
		{
                    if(isOpen!=null&&"false".equals(isOpen.toLowerCase())){
			canvas.getGraphics().drawLine(x+w/2, y, x+w/2, y+h);
                        canvas.getGraphics().drawLine(x, y+h/3, x+w, y+h/3);                        
                    }else{
                        canvas.getGraphics().drawLine(x+w/2, y, x+w/2, y+h/3);
                        canvas.getGraphics().drawLine(x, y+h/3, x+w, y+h/3);
                        canvas.getGraphics().drawLine(x+w/2, y+h*2/3, x+w/2, y+h);
                        canvas.getGraphics().drawLine(x+w, y+h/3+5, x+w/2, y+2*h/3);
                    }
		}                
    }
}
